<template>
	<div class="dialog-container">
		<el-dialog :title="state.dialog.title" v-model="state.dialog.isShowDialog" :close-on-click-modal="false" width="500px">
			<el-form ref="formRef" :model="state.ruleForm" label-width="auto" disabled>
				<el-form-item v-if="Number(state.ruleForm.supplier_amt)" label="扣除供应商金额" prop="supplier_amt">
					<el-input v-model="state.ruleForm.supplier_amt" />
				</el-form-item>
				<el-form-item v-if="Number(state.ruleForm.service_amt)" label="扣除平台服务费" prop="service_amt">
					<el-input v-model="state.ruleForm.service_amt" />
				</el-form-item>
				<el-form-item v-if="Number(state.ruleForm.agent_amt1)" label="扣除铜牌佣金" prop="agent_amt1">
					<el-input v-model="state.ruleForm.agent_amt1" />
				</el-form-item>
				<el-form-item v-if="Number(state.ruleForm.agent_amt2)" label="扣除银牌佣金" prop="agent_amt2">
					<el-input v-model="state.ruleForm.agent_amt2" />
				</el-form-item>
				<el-form-item v-if="Number(state.ruleForm.agent_amt3)" label="扣除金牌佣金" prop="agent_amt3">
					<el-input v-model="state.ruleForm.agent_amt3" />
				</el-form-item>
			</el-form>
		</el-dialog>
	</div>
</template>

<script lang="ts" setup>
import { reactive } from 'vue';

const state = reactive({
	dialog: {
		isShowDialog: false,
		type: '',
		title: '',
		submitLoading: false,
	},
	ruleForm: {
		supplier_amt: '',
		service_amt: '',
		agent_amt1: '',
		agent_amt2: '',
		agent_amt3: '',
	},
});

/********** 触发事件 **********/
/********** 方法事件 **********/
// 打开
const openDialog = (row: any) => {
	state.dialog.isShowDialog = true;
	state.dialog.title = `「${row.order_after_no}」售后单退款明细`;
	state.ruleForm = row;
};

/********** 网络请求 **********/

/********** 方法向父组件暴露 **********/
defineExpose({ openDialog });
</script>
